package me.luger.core.dao.nutz.entity;

import me.luger.core.commom.util.ClazzUtil;
import me.luger.core.commom.util.JsonUtil;
import org.nutz.lang.random.R;

import java.io.Serializable;
import java.util.Map;

/**
 * BaseEntity
 *
 * @author luger
 * @date 2016/10/18 0018
 */
public abstract class BaseEntity implements Serializable {
    @Override
    public String toString() {
        return JsonUtil.toStringFormat(this);
    }

    public String uuid() {
        return R.UU32().toLowerCase();
    }

    public String uid() {
        try {
            return "";
        } catch (Exception e) {
            return "";
        }
    }

    public Integer now() {
        return (int) (System.currentTimeMillis() / 1000);
    }

    public Map<String,Object> toMap(boolean ignoreNull){
        return ClazzUtil.bean2Map(this,ignoreNull);
    }
}
